php convert array to json object

47

json to php array -

<?php
        $json = '[{"name":"xxx","phone":"123","email":"[email protected]"},{"name":"yyy","phone":"456","email":"[email protected]"},{"name":"zzz","phone":"678","email":"[email protected]"}]';
        $json_decoded = json_decode($json);
        echo '<table>';
        foreach($json_decoded as $result){
          echo '<tr>';
            echo '<td>'.$result->name.'</td>';
            echo '<td>'.$result->phone.'</td>';
            echo '<td>'.$result->email.'</td>';
          echo '</tr>';
        }
        echo '</table>';
      ?>

Comments

Submit
0 Comments